import request from '@/utils/request'

// 获取职位类别一级列表
export function getTopList() {
  return request({
    url: '/admin/job_type/admin/get_top_list',
    method: 'get'
  })
}

// 根据id获取子节点数据
export function getChildrenList(id) {
  return request({
    url: '/admin/job_type/admin/get_children_list',
    method: 'get',
    params: { id }
  })
}

// 根据ID查询职位类别详情
export function getJobTypeById(id) {
  return request({
    url: '/admin/job_type/admin/get_by_id',
    method: 'get',
    params: { id }
  })
}

// 新增职位类别
export function addJobType(data) {
  return request({
    url: '/admin/job_type/admin/add',
    method: 'post',
    data
  })
}

// 更新职位类别
export function updateJobType(data) {
  return request({
    url: '/admin/job_type/admin/edit',
    method: 'put',
    data
  })
}

// 删除职位类别
export function deleteJobType(id) {
  return request({
    url: '/admin/job_type/admin/del',
    method: 'delete',
    params: { id }
  })
}

// 延迟刷新职位类别缓存
export function refreshJobTypeCache(delaySeconds = 10) {
  return request({
    url: '/admin/job_type/admin/refreshJobType',
    method: 'post',
    params: { delaySeconds }
  })
}